package com.hz.ruoyimotor.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hz.rouyigonggong.domain.LgDriver;
import com.hz.rouyigonggong.domain.LgVehicle;
import com.hz.ruoyimotor.domain.dto.LgDriverColdDto;
import com.hz.ruoyimotor.domain.dto.LgDriverDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface LgDriverMapper extends BaseMapper<LgDriver> {
    @Select("select * from lg_driver where driver_id = #{driverId}")
    public LgDriver selectById(Integer driverId);
    List<LgDriverDto> getReallyList(@Param("params") Map<String, Object> params , @Param("firstNum") Integer firstNum,
                                    @Param("secondNum") Integer secondNum);
    int getCount(@Param("params") Map<String, Object> params);
    int deleteBatchIds(String[] driverIds);
    @Update("UPDATE lg_driver\n" +
            "SET \n" +
            "    real_name = #{realName}, \n" +
            "    username = #{username}, \n" +
            "    gender = #{gender}, \n" +
            "    account = #{account}, \n" +
            "    password = #{password}, \n" +
            "    age = #{age}, \n" +
            "    email = #{email}, \n" +
            "    phone = #{phone}, \n" +
            "    id_number = #{idNumber}, \n" +
            "    front_image = #{frontImage}, \n" +
            "    back_image = #{backImage}, \n" +
            "    avatar = #{avatar}, \n" +
            "    home_address = #{homeAddress}, \n" +
            "    license_type = #{licenseType}, \n" +
            "    license_image = #{licenseImage}, \n" +
            "    cold_id = #{coldId}, \n" +
            "    status = #{status}, \n" +
            "    update_by = #{updateBy}, \n" +
            "    update_time = NOW(), \n" +
            "    delete_status = #{deleteStatus} \n" +
            "WHERE driver_id = #{driverId};\n")
    int updateById(LgDriver lgDriver);
    int getCountDriver();

    LgDriverDto getDriverMessage(Integer driverId);
    //修改用户名，账号，密码，头像，手机号，地址
    int updateDriverMessage(LgDriver lgDriver);
    //修改用户的状态为运输中
    @Update("update lg_driver set `status` = #{status} where driver_id = #{driverId}")
    int updateDriverStatus(LgDriver lgDriver);

}
